home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / libs / x / xview / xview3.004 / xview3 / usr / openwin / include / xview_private / ei.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-29  |  5.7 KB  |  176 lines

  1. /*    @(#)ei.h 20.21 93/06/28 SMI    */
  2.  
  3. /*
  4.  *    (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents 
  5.  *    pending in the U.S. and foreign countries. See LEGAL NOTICE 
  6.  *    file for terms of the license.
  7.  */
  8.  
  9. #ifndef suntool_entity_interpreter_DEFINED
  10. #define suntool_entity_interpreter_DEFINED
  11.  
  12. /*
  13.  * This defines the programmer interface to the entity interpreter abstraction.
  14.  *
  15.  * Each instance of an entity interpreter is expected to be paired with an
  16.  *   instance of an entity stream.
  17.  */
  18.  
  19. #                    ifndef pr_rop
  20. #include <pixrect/pixrect.h>
  21. #                    endif
  22. #                    ifndef rect_right
  23. #include <xview/rect.h>
  24. #                    endif
  25.  
  26. #                    ifndef sunwindow_attr_DEFINED
  27. #include <xview/attrol.h>
  28. #                    endif
  29. #                    ifndef suntool_entity_stream_DEFINED
  30. #include <xview_private/es.h>
  31. #                    endif
  32.  
  33. struct ei_object {
  34.     struct ei_ops    *ops;
  35.     caddr_t         data;
  36. };
  37. typedef struct ei_object *Ei_handle;
  38.  
  39. struct ei_process_result {
  40.     struct pr_pos    pos;        /* origin of next char */
  41.     struct rect    bounds;        /* boundary of ink */
  42.     unsigned long    break_reason;
  43.     Es_index    last_plus_one;    /* 1st char not painted */
  44.     Es_index    considered;    /* last char considered for paint */
  45. };
  46.     /*
  47.      * Flag bits returned in ei_process_result.break_reason.
  48.      * More than one bit may be on, thus break_reason acts as a mask of
  49.      *   status bits rather than a single status.
  50.      */
  51. #define EI_PR_END_OF_STREAM    0x00000001
  52.     /* Forward scan exhausted the entity stream. */
  53. #define EI_PR_BUF_EMPTIED    0x00000002
  54.     /* Forward scan exhausted the buffer or exceeded specified limit. */
  55. #define EI_PR_NEWLINE        0x00000004
  56.     /* A character in the newline class was encountered. */
  57. #define EI_PR_BUF_FULL        0x00000008
  58.     /* In ei_expand(), the output buffer filled up */
  59. #define EI_PR_HIT_LEFT        0x00000010
  60. #define EI_PR_HIT_TOP        0x00000020
  61. #define EI_PR_HIT_RIGHT        0x00000040
  62. #define EI_PR_HIT_BOTTOM    0x00000080
  63.     /*
  64.      *  Above four reasons indicate attempt to paint ink in violation of
  65.      *   the corresponding boundary of the bounds rectangle.
  66.      */
  67. #define EI_PR_NEXT_FREE        0x00000100
  68. #define EI_PR_CLIENT_REASON(client_mask)                 \
  69.     ( (unsigned long)(0x80000000|client_mask) )
  70.     /*
  71.      * Client code must test for client defined reasons (using == or !=) before
  72.      *   applying bit tests (e.g., reason & EI_PR_NEWLINE) in order to avoid
  73.      *   false matches (e.g., above test would match EI_PR_CLIENT_REASON(4)).
  74.      */
  75.  
  76. #define EI_OP_CHAR        0x00000001
  77. #define EI_OP_WORD        0x00000002
  78. #define EI_OP_DARK_GRAY        0x00000010
  79. #define EI_OP_LIGHT_GRAY    0x00000020
  80. #define EI_OP_STRIKE_THRU    0x00000040
  81. #define EI_OP_DOTS_UNDER    0x00000080
  82. #define EI_OP_STRIKE_UNDER    0x00000100
  83. #define EI_OP_INVERT        0x00000200
  84. #define EI_OP_CLEAR_FRONT    0x01000000    /* default has caller clear */
  85. #define EI_OP_CLEAR_INTERIOR    0x02000000    /* default has caller clear */
  86. #define EI_OP_CLEAR_BACK    0x04000000    /* default has caller clear */
  87. #define EI_OP_CLEARED_RECT    0x08000000    /* caller pre-cleared */
  88. #define EI_OP_MEASURE        0x80000000    /* default is paint */
  89.  
  90.  
  91. struct ei_span_result {
  92.     Es_index    first;
  93.     Es_index    last_plus_one;
  94.     unsigned    flags;
  95. };
  96. #define EI_SPAN_NOT_IN_CLASS        0x00000001
  97. #define EI_SPAN_RIGHT_HIT_NEXT_LEVEL    0x00000002
  98. #define EI_SPAN_LEFT_HIT_NEXT_LEVEL    0x00000004
  99. #define EI_SPAN_HIT_NEXT_LEVEL                        \
  100.         (EI_SPAN_RIGHT_HIT_NEXT_LEVEL|EI_SPAN_LEFT_HIT_NEXT_LEVEL)
  101.  
  102.  
  103. struct ei_ops {
  104.   Ei_handle            (*destroy)();
  105.   caddr_t            (*get)();
  106.   int                (*line_height)();
  107.   int                (*lines_in_rect)();
  108.   struct ei_process_result    (*process)();
  109.   int                (*set)();
  110.   struct ei_span_result        (*span_of_group)();
  111.   struct ei_process_result    (*expand)();
  112. };
  113.  
  114. #define    EI_SPAN_INFO_MASK    0x0000000F
  115. #define    EI_SPAN_CLASS_MASK    0x000000F0
  116.  
  117. #define EI_SPAN_RIGHT_ONLY    0x00000001
  118. #define EI_SPAN_LEFT_ONLY    0x00000002
  119. #define EI_SPAN_IN_CLASS_ONLY    0x00000004
  120. #define EI_SPAN_NOT_CLASS_ONLY    0x00000008
  121. #define EI_SPAN_CHAR        0x00000010
  122. #define EI_SPAN_MORPHENE    0x00000020
  123. #define EI_SPAN_WORD        0x00000030
  124. #define EI_SPAN_PATH_NAME    0x00000040
  125. #define EI_SPAN_LINE        0x00000050
  126. #define EI_SPAN_SENTENCE    0x00000060
  127. #define EI_SPAN_PARAGRAPH    0x00000070
  128. #define EI_SPAN_SECTION        0x00000080
  129. #define EI_SPAN_CHAPTER        0x00000090
  130. #define EI_SPAN_DOCUMENT    0x000000A0
  131. #define EI_SPAN_SP_AND_TAB    0x000000B0
  132. #define EI_SPAN_CLIENT1        0x000000C0
  133. #define EI_SPAN_CLIENT2        0x000000D0
  134. #define EI_SPAN_POINT           0x000000E0 /* laf */
  135.  
  136. /* Valid attributes for ei_get/set */
  137. #define EI_ATTR(type, ordinal)    ATTR(ATTR_PKG_ENTITY, type, ordinal)
  138. #define EI_ATTR_LIST(ltype, type, ordinal)    \
  139.     EI_ATTR(ATTR_LIST_INLINE((ltype), (type)), (ordinal))
  140. typedef enum {
  141.     EI_CONTROL_CHARS_USE_FONT    = EI_ATTR(ATTR_BOOLEAN,         10),
  142.     EI_FONT                = EI_ATTR(ATTR_PIXFONT_PTR,     20),
  143. #ifdef OW_I18N
  144.     EI_LOCALE_IS_ALE        = EI_ATTR(ATTR_INT,         25),
  145. #ifdef FULL_R5
  146.     EI_LINE_SPACE            = EI_ATTR(ATTR_INT,         26),
  147. #endif /* FULL_R5 */
  148. #endif /* OW_I18N */
  149.     EI_SPANW            = EI_ATTR(ATTR_OPAQUE,         30),
  150.     EI_SPAN1            = EI_ATTR(ATTR_OPAQUE,         40),
  151.     EI_SPAN2            = EI_ATTR(ATTR_OPAQUE,         50),
  152.     EI_TAB_WIDTH            = EI_ATTR(ATTR_INT,         60),
  153.     EI_TAB_WIDTHS            = EI_ATTR_LIST(ATTR_NULL, ATTR_INT,     70)
  154. } Ei_attribute;
  155.  
  156. #define ei_destroy(eih)                            \
  157.     (*(eih)->ops->destroy)(eih)
  158. #define ei_get(eih, attr)                        \
  159.     (*(eih)->ops->get)(eih, attr)
  160. #define ei_line_height(eih)                        \
  161.     (*(eih)->ops->line_height)(eih)
  162. #define ei_lines_in_rect(eih, rect)                    \
  163.     (*(eih)->ops->lines_in_rect)(eih, rect)
  164. #define ei_process(eih, op, esbuf, x, y, rop, pw, rect, tab_origin)    \
  165.     (*(eih)->ops->process)(eih, op, esbuf, x, y, rop, pw, rect, tab_origin)
  166. #define ei_expand(eih, esbuf, rect, x, obuf, obuf_len, tab_origin)    \
  167.     (*(eih)->ops->expand)(eih, esbuf, rect, x, obuf, obuf_len, tab_origin)
  168. /* VARARGS */
  169. EXTERN_FUNCTION( int ei_set, (Ei_handle eih, DOTDOTDOT));
  170. #define ei_span_of_group(eih, esbuf, group_spec, index)            \
  171.     (*(eih)->ops->span_of_group)(eih, esbuf, group_spec, index)
  172.  
  173.  
  174. #endif
  175.  
  176.